package com.cskaoyan.service.admin.impl;

import com.cskaoyan.bean.admin.Configuration.*;
import com.cskaoyan.mapper.SystemMapper;
import com.cskaoyan.service.admin.ConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ConfigServiceImpl implements ConfigService {

    @Autowired
    SystemMapper systemMapper;

    @Override//向磊 admin/config/mall（get请求）
    public ConfigMallVo mall() {
        String s1 = systemMapper.selectConfigMall(46);
        String s2 = systemMapper.selectConfigMall(38);
        String s3 = systemMapper.selectConfigMall(44);
        String s4 = systemMapper.selectConfigMall(40);

        ConfigMallVo configMallVo = new ConfigMallVo();
        configMallVo.setCskaoyanmall_mall_address(s1);
        configMallVo.setCskaoyanmall_mall_name(s2);
        configMallVo.setCskaoyanmall_mall_phone(s3);
        configMallVo.setCskaoyanmall_mall_qq(s4);

        return configMallVo;
    }
    @Override//向磊 admin/config/mall（post请求）
    public void UpdateMall(ConfigMallBo configMallBo) {
        systemMapper.updateMall(configMallBo.getCskaoyanmall_mall_address(),46);
        systemMapper.updateMall(configMallBo.getCskaoyanmall_mall_name(),38);
        systemMapper.updateMall(configMallBo.getCskaoyanmall_mall_phone(),44);
        systemMapper.updateMall(configMallBo.getCskaoyanmall_mall_qq(),40);
    }


    @Override//向磊 admin/config/express （get请求）
    public ConfigExpressVo configExpress() {
        String s1 = systemMapper.selectConfigExpress(37);
        String s2 = systemMapper.selectConfigExpress(39);

        ConfigExpressVo configExpressVo = new ConfigExpressVo();
        configExpressVo.setCskaoyanmall_express_freight_min(s1);
        configExpressVo.setCskaoyanmall_express_freight_value(s2);

        return configExpressVo;
    }

    @Override//向磊 admin/config/express （post请求）
    public void updateExpress(ConfigExpressBo configExpressBo) {
        systemMapper.updateExpress(configExpressBo.getCskaoyanmall_express_freight_min(),37);
        systemMapper.updateExpress(configExpressBo.getCskaoyanmall_express_freight_value(),39);
    }


    @Override//向磊 admin/config/order （get请求）
    public ConfigOrderVo configOrder() {
        String s1 =  systemMapper.selectConfigOrder(35);
        String s2 =  systemMapper.selectConfigOrder(33);
        String s3 =  systemMapper.selectConfigOrder(42);

        ConfigOrderVo configOrderVo = new ConfigOrderVo();
        configOrderVo.setCskaoyanmall_order_unconfirm(s1);
        configOrderVo.setCskaoyanmall_order_unpaid(s2);
        configOrderVo.setCskaoyanmall_order_comment(s3);

        return configOrderVo;
    }

    @Override//向磊 admin/config/order (post请求)
    public void updateOrder(ConfigOrderBo configOrderBo) {
        systemMapper.updateOrder(configOrderBo.getCskaoyanmall_order_comment(),42);
        systemMapper.updateOrder(configOrderBo.getCskaoyanmall_order_unconfirm(),35);
        systemMapper.updateOrder(configOrderBo.getCskaoyanmall_order_unpaid(),33);
    }


    @Override//向磊 admin/config/wx （get请求）
    public ConfigWxVo configWx() {
        String s1 = systemMapper.selectConfigWx(43);
        String s2 = systemMapper.selectConfigWx(45);
        String s3 = systemMapper.selectConfigWx(47);
        String s4 = systemMapper.selectConfigWx(41);
        String s5 = systemMapper.selectConfigWx(34);
        String s6 = systemMapper.selectConfigWx(48);
        String s7 = systemMapper.selectConfigWx(36);

        ConfigWxVo configWxVo = new ConfigWxVo();
        configWxVo.setCskaoyanmall_wx_catlog_goods(s1);
        configWxVo.setCskaoyanmall_wx_catlog_list(s2);
        configWxVo.setCskaoyanmall_wx_index_brand(s3);
        configWxVo.setCskaoyanmall_wx_index_hot(s4);
        configWxVo.setCskaoyanmall_wx_index_new(s5);
        configWxVo.setCskaoyanmall_wx_index_topic(s6);
        configWxVo.setCskaoyanmall_wx_share(s7);

        return configWxVo;
    }

    @Override//向磊 admin/config/wx (post请求)
    public void updateWx(ConfigWxBo configWxBo) {
        systemMapper.updateWx(configWxBo.getCskaoyanmall_wx_catlog_goods(),43);
        systemMapper.updateWx(configWxBo.getCskaoyanmall_wx_catlog_list(),45);
        systemMapper.updateWx(configWxBo.getCskaoyanmall_wx_index_brand(),47);
        systemMapper.updateWx(configWxBo.getCskaoyanmall_wx_index_hot(),41);
        systemMapper.updateWx(configWxBo.getCskaoyanmall_wx_index_new(),34);
        systemMapper.updateWx(configWxBo.getCskaoyanmall_wx_index_topic(),48);
        systemMapper.updateWx(configWxBo.getCskaoyanmall_wx_share(),36);

    }


}
